words=input();number='';a=0;b=1
English_numbers=["zero","one","two","three","four","five","six","seven","eight","nine"]
def find_del(numbers):
    a=0
    for i in range(1, int(numbers ** (1 / 2)) + 1):
        if numbers%i==0:
            a+=1
            if i!=numbers//i:a+=1
    if a>2:return '-'
    else:return '+'
if len(words.split())==3:
    for i in range(0,3):
        if words.split()[i] in English_numbers:number+=str(English_numbers.index(words.split()[i]));a+=1
        else:print("Wrong input");break
    if a==3:
        number=int(number)
        if find_del(number)=='-':
            while True:
                if find_del(number-b)=='+':print(number-b);break
                elif find_del(number+b)=='+':print(number+b);break
                b+=1
        else:print(number)
else:print("Wrong input")
